﻿using Autofac;
using SIS.Infrastructures.Dependencies;

namespace SIS.Infrastructures.Modules
{
    public class RepositoryModule : Autofac.Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterAssemblyTypes(Initialize.ReferencedAssemblies()).PublicOnly()
                .Where(type => typeof(IRepository).IsAssignableFrom(type) && !type.IsAbstract)
                .AsImplementedInterfaces()
                .InstancePerLifetimeScope();
        }
    }
}
